#ifndef SPRITELIST_H_INCLUDED
#define SPRITELIST_H_INCLUDED

#include <iostream>
#include <list>

#include "ID_Manager.h"
#include "Mutex_Wrapper.h"
#include "Image_Wrapper.h"
#include "Misc.h"
#include "Debug.h"

using namespace std;


class SpriteListItem
{
        public:
        uint m_imgId;
        uint m_spriteId;
        SDL_Rect m_rect;
        string m_id;
};


class SpriteList
{
    protected:
    static SpriteList *instance;

    list<SpriteListItem> m_sprites;
    Mutex_Wrapper m_mutex;
    public:
    SpriteList();
    bool add(uint imgId, uint spritId, SDL_Rect rect);
    bool find(uint spriteId, uint &imgId, RectInfo &rect);
    static SpriteList* get_instance();
    static void destroy();
    SpriteListItem &operator[](uint index);
    ~SpriteList();
    void clear();
};

inline void SpriteList::clear()
{
    m_sprites.clear();
}

inline SpriteList::~SpriteList()
{
    clear();
}

#endif // SPRITELIST_H_INCLUDED
